package cn.nnxy.zentao.service.impl;

import cn.nnxy.zentao.domain.ZBug;
import cn.nnxy.zentao.mapper.ZBugMapper;
import cn.nnxy.zentao.query.BaseQuery;
import cn.nnxy.zentao.service.BugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BugServiceImpl implements BugService {

    @Autowired
    private ZBugMapper bugMapper;

    @Override
    public List<ZBug> queryList(BaseQuery query) {
        return bugMapper.selectList(query);
    }

    @Override
    public ZBug seletById(Integer id) {
        if (null == id){
            return null;
        }
        return bugMapper.selectById(id);
    }

    @Override
    public int saveBug(ZBug bug) {
        if (null == bug){
            return 0;
        }
        return bugMapper.insert(bug);
    }

    @Override
    public int updateById(ZBug bug) {
        if (null == bug || bug.getBugId() == null) {
            return 0;
        }
        return bugMapper.updateById(bug);
    }

    @Override
    public int deleteById(Integer id) {
        if (null == id){
            return 0;
        }
        return bugMapper.deleteById(id);
    }
}
